<h2>Add Payment</h2>
<div class="errorval"><?php echo validation_errors(); ?>
<?php echo $error; ?></div>
<p>To add a payment, enter details into the fields below.</p>
<center>
<!-- Subscriber information -->
<table>
<tr>
	<td colspan="2">
		<b>Name:</b> <?php echo $subscriber->first_name . ' ' . $subscriber->last_name; ?> <br />
		<b>Address:</b> <?php echo $subscriber->address1 . ', ' . $subscriber->post_code . ', ' . $subscriber->suburb; ?> <br / >
		<b>Expiry Date:</b>
		<?php
			if ($subscriber_paid)
			{
				echo $subscriber_paid->expiry_date;
				
				if ( $subscriber_paid->expiry_date < date('Y-m-d') )
					echo '<font color="red"> (EXPIRED) </font>';
			}
				
			else
				echo '<font color="red">No Payments Made</font>';
		?><br/>
		<b>Subscriber Status: </b> <?php echo $subscriber->subscriber_status; ?>
	</td>
</tr>
</table>
<br />
<table>
<?php echo form_open('staff/subscriber_management/addPayment/' . $subscriber->subscriber_id); ?>
<?php echo form_hidden('subscriber_id', $subscriber->subscriber_id); ?>
<tr>
	<th width="30%" align="right">* Date Paid:</th>
	<td><?php echo form_input('date_paid', date('Y-m-d')); ?></td>
</tr>
<tr>
	<th align="right">* Receipt Number:</th>
	<td><?php echo form_input('receipt_number', set_value('receipt_number'), 'maxlength="6"'); ?></td>
</tr>
<tr>
	<th align="right">* Amount:</th>
	<td><?php echo form_input('amount', set_value('amount')); ?></td>
</tr>
<tr>
	<th align="right">* Expiry Date:</th>
	<td>
	<?php
	if ($subscriber_paid)
	    echo form_input( 'expiry_date', date('Y-m-d', strtotime ( '+1 year' , strtotime ( $subscriber_paid->expiry_date ) ) ) );
	    
	else
	    echo form_input( 'expiry_date', date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y') + 1)) ); ?>
	</td>
</tr>
<tr>
	<th align="right" class="tablehead">Actions</th>
	<td><?php echo form_submit('', 'Submit'); ?></td>
</tr>
<?php echo form_close(); ?>
</table>
</center>

<script type="text/javascript">
$(document).ready(function() {
		$( '[name=date_paid]' ).datepicker({ dateFormat: 'yy-mm-dd', changeMonth: true, changeYear: true });
		$( '[name=expiry_date]' ).datepicker({ dateFormat: 'yy-mm-dd', changeMonth: true, changeYear: true });
});
</script>
